package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppInspectionPlanMapper;
import com.ep.modules.app.entity.AppInspectionPlan;
import com.ep.modules.app.entity.AppInspectionPlanExample;
import com.ep.modules.app.service.AppInspectionPlanService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppInspectionPlanServiceImpl implements AppInspectionPlanService {
    @Autowired
    private AppInspectionPlanMapper appInspectionPlanMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppInspectionPlanExample example = new AppInspectionPlanExample();
        AppInspectionPlanExample.Criteria criteria = example.createCriteria();
        List<AppInspectionPlan> list = appInspectionPlanMapper.selectByExample(example);
        Page<AppInspectionPlan> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppInspectionPlan getById(Long id) {
        return appInspectionPlanMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppInspectionPlan entity) {
        appInspectionPlanMapper.insert(entity);
    }

    public void update(AppInspectionPlan entity) {
        appInspectionPlanMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appInspectionPlanMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}